package com.yingli.component.activity.launch;

import android.content.Intent;
import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.yingli.component.R;

public class StandardActivity extends AppCompatActivity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_standard);
        findViewById(R.id.tv_start).setOnClickListener(v->{
            Intent intent = new Intent(this,StandardActivity.class);
            //设置启动模式为singleTask
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
            //设置启动模式为singleTop
            intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
            startActivity(intent);
        });
        findViewById(R.id.btn_singleTop).setOnClickListener(v->{
            startActivity(new Intent(this,SingleTopActivity.class));
        });
        findViewById(R.id.btn_singleTask).setOnClickListener(v->{
            startActivity(new Intent(this,SingleTaskActivity.class));
        });
        findViewById(R.id.btn_singleInstance).setOnClickListener(v->{
            startActivity(new Intent(this,SingleInstanceActivity.class));
        });
    }
}
